<%@ include file="../common.jsp" %>

<script type="text/javascript">
	$(document).ready(function(){
		/* createLayoutForAddOrEdit('uploadDocNorthPane','uploadDocTabs'); */
		setPageTitle('<tiles:getAsString name="pageTitle"/>');
		setWorkFlowURL('<c:out value="${flowExecutionUrl}" />');
		$( "#linkedDocId" ).selectable();
		var status = '<c:out value="${renewalDetailsForm.documentStatus}"></c:out>';
		if(status.indexOf("Deactive", 0) != -1){
			$("#activateButton").val('ReActivate');
		}
		else{
			$("#activateButton").val('Deactivate');
		}
	});
</script>

<div align="center">
	<table class="bodyTable" >
		<tr>
			<td>
				<table class="filtersTable zeroBorder" style="width: 100%;">
					<tr class="tableChildHeaderColor" align="left" style="width: 100%;">
						<td>
							<table style="width: 100%;">
								<tr>
									<td style="width: 80%;">
										<table >
											<tr>
												<td class="spacingColumnWidthLess"></td>
												<td align="left">
													<!-- <img alt="" src="./customTheme/Icons/BlueLotus_DMS_icons-11.png"> -->
												</td>
												<td class="spacingColumnWidthLess"></td>
												<td style="vertical-align: middle;">
													<c:choose>
														<c:when test="${fn:contains(renewalDetailsForm.documentStatus,'Deactive')}">
															<span class="tableMainHeaderFont">REACTIVATE DOCUMENT</span>
														</c:when>
														<c:otherwise>
															<span class="tableMainHeaderFont">DEACTIVATE DOCUMENT</span>
														</c:otherwise>
													</c:choose>
												</td>
											</tr>
										</table>
									</td>
									<td style="width: 20%;">
										<table class="zeroBorder" style="width: 100%;">
											<tr align="right">
												<td >
													<input type="button" class="formButton" value="Back" onclick="javascript:workFlowDetail('renewalDetailsForm','back');"/>&nbsp;
													<input type="button" value="Deactivate" class="formButton"
														onclick="activateOrDeactivate('<c:out value="${renewalDetailsForm.docId}"></c:out>','<c:out value="${renewalDetailsForm.documentStatus}"></c:out>')" id="activateButton">&nbsp;
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr class="formSpacingRow formBlockColor"><td></td></tr>
					<tr>
						<td align="center">
						<div id="uploadDocTabs" class="formBlockColor"  style="overflow: auto;">
							<form:form commandName="renewalDetailsForm" id="renewDocForm" action="${flowExecutionUrl}" enctype="multipart/form-data" method="POST">
							<form:hidden path="docId" value="${renewalDetailsForm.docId}"/>
								<table style="width: 100%;" border="0" class="formTable" >
									
									<tr  align="left">
										<td class="spacingColumnWidthLess">&nbsp;</td>
										<td colspan="3" align="right">
											<div class="ui-corner-all" style="width: 80%; border-style: dotted; border-width:1px; height: 3em; padding: 10px; text-align: left;">
												<span class="formLabel">Attached Document:&nbsp;</span>
												<br><a target="_blank" href="downloadAttachment/${renewalDetailsForm.docId}.htm">${renewalDetailsForm.docName}</a>
												
											</div> 
										</td>
										<td class="spacingColumnWidthMedium"></td>
										<td colspan="3" align="left">
											<div class="ui-corner-all" style="width: 80%; border-style: dotted; border-width:1px; height: 3em; padding: 10px; overflow: auto;">
												<span class="formLabel">Link Documents&nbsp;
												</span>
												<ul id="linkedDocId" class="userListClass">
												<c:forEach items="${linkedDocumentMap}" var="linkedDocumentMap">
													<li id="${linkedDocumentMap.key}" class="ui-state-default">${linkedDocumentMap.value}</li>
													<input type="hidden" name="linkedDocId" id="${linkedDocumentMap.key}" value="${linkedDocumentMap.key}">
												</c:forEach>
												</ul>
									   				
											</div>
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>
									
									<tr class="formSpacingRow formBlockColor">
										<td colspan="9">
											<hr>
										</td>
									</tr>
									
									<tiles:insertAttribute name="viewAttrDetails"></tiles:insertAttribute>
									
									<tr class="formSpacingRow formBlockColor">
										<td colspan="9">
											<hr>
										</td>
									</tr>
									
									<tiles:insertAttribute name="viewOwnerDetails"></tiles:insertAttribute>
									
									<tr class="formSpacingRow formBlockColor">
										<td colspan="9">
											<hr>
										</td>
									</tr>
									
									<tiles:insertAttribute name="viewValidityDetails"></tiles:insertAttribute>
									
									
									
									<tr class="formSpacingRow formBlockColor"><td colspan="9"></td></tr>
									
									<!-- <tr class="formSpacingRow formBlockColor">
										<td colspan="9">
											<hr>
										</td>
									</tr>
									<tr>
										<td colspan="5"></td>
										<td colspan="3" align="right">
											<input type="reset" value="RESET" name="resetForm" class="resetButton">
											<span class="spacingColumnWidthLess">&nbsp;</span>
											<input type="hidden" value="ajaxRequest" name="ajaxSource">
											<input type="button" class="formButton ui-corner-all" value="UPLOAD" onclick="loadContentToServer('uploadNewDocForm','contentDiv')">	
										</td>
										<td class="spacingColumnWidthLess"></td>
									</tr>	 -->												
								</table>
							</form:form>
					</div>
						</td>
				</table>
			</td>
		</tr>
	</table>
</div>

<%-- <div id="uploadDocNorthPane" class="ui-layout-north ui-widget-header">
	<table class="tabsHeaderTable" >
		<tr>
			<td><span>Deactivate/Reactivate Document</span></td>
		</tr>
	</table>
</div>
	<form:form commandName="renewalDetailsForm" id="linkDocumentForm" action="${flowExecutionUrl}" enctype="multipart/form-data" method="POST">
		<div id="uploadDocTabs" class="ui-layout-center">
		<form:hidden path="docId"/>
		<label class="infoClass"><c:out value="${statusMsg}"></c:out></label>
		<table cellpadding="0" cellspacing="0" border="0" width="90%">
			<tr>
				<td>
					<table>
						<tiles:insertAttribute name="attrDetails"></tiles:insertAttribute>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<hr/>
					<table>
						<tiles:insertAttribute name="ownerDetails"></tiles:insertAttribute>
					</table>
				</td>
			</tr>
			<tr>
				<td>
				<hr/>
					<h5>Linked Documents</h5>
					<div id="linkedDocument">
						
						<ul id="linkedDocId" class="userListClass">
						<c:forEach items="${linkedDocumentMap}" var="linkedDocumentMap">
							<li id="${linkedDocumentMap.key}" class="ui-state-default">${linkedDocumentMap.value}</li>
							<input type="hidden" name="linkedDocId" id="${linkedDocumentMap.key}" value="${linkedDocumentMap.key}">
						</c:forEach>
						<c:forEach var="linkedDocumentList" items="${linkedDocumentList}">
		     					<input type="hidden" name="oldLinkedDocument" value="${linkedDocumentList}"></input>
		    				</c:forEach>
						</ul>
						<img alt="" height="40" src="<c:url value="/search.png"></c:url>" onclick="showDocumentLookUpDialog();">
							
						<input type="button" value="Delete" onclick="deleteDocument()"/>
						<input type="button" value="Update Document Link" onclick="updateDocumentLink('linkDocumentForm')"/>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<hr/>
					<table>
						<tiles:insertAttribute name="validityDetails"></tiles:insertAttribute>
					</table>
				</td>
			</tr>
			<tr>
				<td><input type="button" value="Deactivate" onclick="activateOrDeactivate('<c:out value="${renewalDetailsForm.docId}"></c:out>')" id="activateButton">
			</tr>						
		</table>
	</div>		
</form:form> --%>